package com.kws.merchant.controller;


import com.kws.merchant.domain.AfterSalesHistory;
import com.kws.merchant.domain.AfterSalesWarranty;
import com.kws.merchant.domain.po.AfterSalesWarrantyPo;
import com.kws.merchant.domain.vo.AfterSalesWarrantyVo;
import com.kws.merchant.service.AfterSalesWarrantyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.kws.common.core.domain.R;

import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * 售后-保修单(AfterSalesWarranty)表控制层
 *
 * @author yxy
 * @since 2024-10-22 19:23:10
 */
@RestController
@Api(tags = "售后-保修单(AfterSalesWarranty)")
@RequestMapping("afterSalesWarranty")
public class AfterSalesWarrantyController {
    /**
     * 服务对象
     */
    @Resource
    private AfterSalesWarrantyService afterSalesWarrantyService;

    @PostMapping("/page")
    @ApiOperation(value = "分页查询列表")
    public R<Page<AfterSalesWarranty>> pageList(@RequestBody AfterSalesWarrantyPo afterSalesWarrantyPo) {
        return R.ok(afterSalesWarrantyService.pageList(afterSalesWarrantyPo));
    }

    @GetMapping("/detailById/{id}")
    @ApiOperation(value = "通过主键查询单条数据")
    public R<AfterSalesWarranty> detailById(@PathVariable Long id) {
        return R.ok(afterSalesWarrantyService.detailById(id));
    }


    @PostMapping("/add")
    @ApiOperation(value = "新增保修单")
    public R addItem(@RequestBody AfterSalesWarranty afterSalesWarranty) {
        return R.ok(afterSalesWarrantyService.addItem(afterSalesWarranty));
    }

    @PostMapping("/dispose")
    @ApiOperation(value = "保修处理")
    public R dispose(@RequestBody AfterSalesWarranty afterSalesWarranty) {
        return R.ok(afterSalesWarrantyService.dispose(afterSalesWarranty));
    }


    @PostMapping("/delete")
    @ApiOperation(value = "删除数据")
    public R delete(@RequestBody List<Long> idList) {
        return R.ok(afterSalesWarrantyService.delete(idList));
    }
}
